package com.ts.conch.admin.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.ts.conch.admin.component.MybatisStdOutImpl;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author IDai
 */
@EnableTransactionManagement
@Configuration
@MapperScan("com.ts.conch.dao")
public class MybatisPlusConfig {

    /**
     * Mybatis-plus分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
     * 注入日志组件 （从yml文件中配置的方式，打包后有概率无法启动项目且无法解决，故用此方法注入自定义日志组件）
     * @param sqlSessionFactory
     */
//    @Autowired
//    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
//        sqlSessionFactory.getConfiguration().setLogImpl(MybatisStdOutImpl.class);
//    }


}
